package com.battery.controller;


import com.battery.pojo.Vip_Order;
import com.battery.service.UserService;
import com.battery.service.VipOrderService;
import com.battery.util.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "Vip订单管理相关接口")
@RequestMapping("/vipOrder")
public class VipOrderController {

    @Autowired
    private VipOrderService vipOrderService;
    @Autowired
    private UserService userService;

    @PostMapping("/saveVipOrder")
    @ApiOperation("添加会员")
    public Result addVip(@RequestBody @ApiParam(name="会员订单对象",value="传入json格式",required=true)Vip_Order vip_order) {
        return vipOrderService.insert(vip_order);
    }

    @PostMapping("/getVipOrderZt/{user_id}")
    @ApiOperation("查看用户的会员订单支付状态")
    public Result setVip(int user_id) {
        return vipOrderService.getVipOrderZt(user_id);
    }

    @GetMapping("/list")
    @ApiOperation("查询所有会员")
    public Result searchAllVip() {
        return vipOrderService.searchVipOrder();
    }
}